unit uCreateBill;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ComCtrls, Spin;

type
  TfmCreateBill = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    seRubel: TSpinEdit;
    Label4: TLabel;
    seKopec: TSpinEdit;
    Label5: TLabel;
    dtpBillDate: TDateTimePicker;
    dtpExpireDate: TDateTimePicker;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    dtpBillTime: TDateTimePicker;
  private
    { Private declarations }
  public
    { Public declarations }

    Amount : double;
    BillDate : string;
    ExpireDate : string;

    function Execute : boolean;
  end;

var
  fmCreateBill: TfmCreateBill;

implementation

{$R *.dfm}

{ TfmCreateBill }

function TfmCreateBill.Execute: boolean;
begin
  result := false;

  dtpBillDate.DateTime := now;
  dtpBillTime.DateTime := now;

  dtpExpireDate.Date := now + 5;

  if ShowModal = mrOk then
  begin
    amount := seRubel.Value + seKopec.Value * 0.01;

    BillDate := FormatDateTime('dd.mm.yyyy', dtpBillDate.Date) + FormatDateTime('hh:nn:ss', dtpBillTime.Time);
    ExpireDate := FormatDateTime('dd.mm.yyyy', dtpExpireDate.Date);

    result := true;
  end;
end;

end.
